fix(execution): strip quoted literals and heredoc bodies before path check#20
Merged
Merged
Conversation
…check The workspace-path safety check tokenized the whole command string by whitespace, so JavaDoc-style tokens such as /** and */ inside `echo` arguments, `cat << 'EOF'` bodies, or `python3 -c` strings were treated as absolute paths outside the project and the command was blocked. Add a small lexer that replaces single/double-quoted literals and bash heredoc bodies (quoted, unquoted, and tab-stripped variants) with a single space before tokenization. User approval remains the primary gate; this only reduces false positives on legitimate commands.
|
Failed to generate code suggestions for PR |
Collaborator
|
/review |
|
Preparing review... |
…g plan The Volcengine ARK coding-plan endpoint only supports a whitelist of models. Setting only CONFIG.MODEL left CONFIG.MODEL_WEAK and CONFIG.FALLBACK_MODELS at PR-Agent's built-in default (o4-mini), which the endpoint rejects with `404 UnsupportedModel`. As a result, pr_description and improve (code suggestions) failed silently every run. Pin all three model slots to MiniMax-M2.5 so every PR-Agent step uses the same coding-plan-compatible model.
- Explicitly enable AUTO_DESCRIBE / AUTO_REVIEW / AUTO_IMPROVE so every push to a PR (`synchronize`) runs describe + review + improve without relying on upstream defaults. - Tighten the job `if`: for issue_comment / pull_request_review_comment events, require `github.event.comment.author_association` to be OWNER / MEMBER / COLLABORATOR. Previously any non-bot commenter on a PR could re-trigger the workflow under pull_request_target, which had access to repository secrets — a fork-PR command-injection hole. - pull_request[_target] events still gate by the PR author's role. Net effect: designated reviewers can manually re-trigger via slash commands (e.g. `/review`), fork authors cannot.
Owner
Author
|
/review |
|
Preparing review... |
genni613
approved these changes
Apr 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
hasPathsOutsideWorkspacesplit the entire command by whitespace, so JavaDoc-style tokens (/**,*/) inside quoted args or<< 'EOF'heredoc bodies were flagged as absolute paths outside the project and the command was blocked — e.g.cat > Foo.java << 'EOF' ... /** javadoc */ ... EOF,echo '/**',python3 -c "... /** ...".stripLiteralsAndHeredocs+consumeHeredoc) that replaces single/double-quoted literals and bash heredoc bodies (quoted, unquoted,<<-tab-stripped) with a single space before tokenization.<<<here-strings are intentionally left to the quote handler.WHITESPACEregex hoisted to file-level,regionMatchesused in heredoc line scan to avoid per-lineStringallocations.Trade-off: a fully quoted absolute path (
cat "/etc/passwd") no longer trips the check. User approval is the real gate — this reduces false positives on legitimate commands, not security.Test plan
./gradlew test --tests "*ShellPlatformTest*"— 45/45 passing, includes 13 new regression tests (Unix quoted/heredoc variants, Windows quoted drive paths,<<<positive/negative, malformed unclosed quote, heredoc followed by real/etc/passwd)../gradlew testBUILD SUCCESSFUL.cat > Foo.java << 'EOF' ... EOF,echo '/** ... */', andpython3 -c "... /** ..."commands reach the approval dialog instead of being silently blocked.